package tech.dx.springdb.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tech.dx.springdb.entity.CourseAdvice;
import tech.dx.springdb.service.CourseAdviceService;

/**
 * @ClassName CourseAdviceController
 * @Description TODO
 * @Author omg
 * @Date 2019/4/5 16:31
 * @Version 1.0
 */
@RestController
@RequestMapping("courseadvice")
@Api(tags = {"课程建议"})
public class CourseAdviceController {

    @Autowired
    private CourseAdviceService courseAdviceService;

    @GetMapping("/{id}")
    public CourseAdvice get(@PathVariable long id) {
        CourseAdvice courseAdvice = courseAdviceService.getById(id);
        return courseAdvice;
    }

    @PostMapping
    public CourseAdvice add(@RequestBody CourseAdvice courseAdvice) {
        return courseAdviceService.add(courseAdvice);
    }

    @PutMapping("/{id}")
    public CourseAdvice update(@RequestBody CourseAdvice classType, @PathVariable long id) {
            return courseAdviceService.update(classType);
    }

}
